# proxy_cli.sh
# sed -i 's/\r//' file
# source proxy_cli.sh
# source proxy_cli.sh off
ip=127.0.0.1
port=7890

proxy_on() {
    export https_proxy=http://${ip}:${port}
    export http_proxy=http://${ip}:${port}
    export all_proxy=socks5://${ip}:${port}
    echo "Proxy ON  → ${ip}:${port}"
}

proxy_off() {
    unset https_proxy http_proxy all_proxy
    echo "Proxy OFF → 已取消所有代理"
}

case "$1" in
    off) proxy_off ;;
    *)   proxy_on  ;;
esac